
export const list2Tree = (list, id) => {
  const arr = []
  list.forEach((item) => {
    if (item.pid === id) {
      arr.push(item)
      const children = list2Tree(list, item.id)
      if (children.length > 0) {
        item.children = children
      }
    }
  })
  return arr
}
